using Services;

public class PerformanceManager : Service
{
    public Performance CurrentPerformance { get; private set; }

    public bool TrySetPerformance(Performance performance)
    {
        if (CurrentPerformance == null)
        {
            CurrentPerformance = performance;
            return true;
        }
        return false;
    }

    public bool TryResume(Performance performance)
    {
        return performance == CurrentPerformance;
    }

    public void AfterEndPerformance(Performance performance)
    {
        if (CurrentPerformance == performance)
            CurrentPerformance = null;
        else
            throw new System.ArgumentException();
    }
}
